
class system {

  particle_group particle_group;
  particle[] particles;

  collision_detector collision_detector;
  gravity gravity;

  int number_of_particles;




  system(particle_group particle_group) {
    this.particle_group = particle_group;

    particles = particle_group.particles;
    number_of_particles = particles.length;

    collision_detector = new collision_detector();
    gravity = new gravity();
  }

  void math() {



    for(int active=0; active<number_of_particles;active++) {
      for(int passive=0;passive<number_of_particles;passive++) {

        collision_detector.set_particle_one(particles[active]);
        gravity.set_particle_one(particles[active]);

        if((active !=passive) && (particles[passive].alive) && (particles[active].alive)) {         

          if(collision_detector.is_collision(particles[passive])) { 
            if(particles[active].mass >= particles[passive].mass) {
              
            }
          }
          else {
            gravity.set_distance(collision_detector.distance);
            gravity.apply_gravity(particles[passive]);
           
          }
        }
      }
    }
  }


}

